import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../controllers/settings_controller.dart';
import '../l10n/app_localizations.dart';

class VipUpgradeBanner extends StatelessWidget {
  const VipUpgradeBanner({super.key});

  @override
  Widget build(BuildContext context) {
    final SettingsController controller = Get.find();
    final l10n = AppLocalizations.of(context);

    return Obx(() {
      if (!controller.showVipBanner.value) {
        return const SizedBox.shrink();
      }

      return Container(
        margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h),
        padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 16.h),
        decoration: BoxDecoration(
          image: DecorationImage(
            image: AssetImage("assets/images/bg_section_rounded.png"),
            fit: BoxFit.fill,
          ),
        ),
        child: Row(
          children: [
            // 左侧内容
            Expanded(
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    l10n.vipUpgrade,
                    style: TextStyle(
                      color: Colors.white,
                      fontSize: 18.sp,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                  SizedBox(height: 4.h),
                  Text(
                    l10n.improveMiningSpeed,
                    style: TextStyle(
                      color: Colors.white70,
                      fontSize: 14.sp,
                      fontWeight: FontWeight.w400,
                    ),
                  ),
                ],
              ),
            ),

            SizedBox(width: 16.w),

            // 升级按钮
            GestureDetector(
              onTap: controller.vipUpgrade,
              child: Container(
                padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h),
                decoration: BoxDecoration(
                  color: const Color(0xFF00FFFF),
                  borderRadius: BorderRadius.circular(60.r),
                  boxShadow: [
                    BoxShadow(
                      color: const Color(0xFF00FFFF).withOpacity(0.3),
                      blurRadius: 8,
                      offset: const Offset(0, 2),
                    ),
                  ],
                ),
                child: Text(
                  l10n.upgrade,
                  style: TextStyle(
                    color: const Color(0xFF061125),
                    fontSize: 14.sp,
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ),
            ),

            // SizedBox(width: 8.w),

            // // 关闭按钮
            // GestureDetector(
            //   onTap: controller.hideVipBanner,
            //   child: Container(
            //     padding: EdgeInsets.all(4.w),
            //     decoration: BoxDecoration(
            //       color: Colors.white.withOpacity(0.1),
            //       shape: BoxShape.circle,
            //     ),
            //     child: Icon(Icons.close, color: Colors.white70, size: 16.sp),
            //   ),
            // ),
          ],
        ),
      );
    });
  }
}
